﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <WtmSearcher v-model="searchDataIntgrSyncRemote" @search="()=>{getTableDataIntgrSyncRemote();}">
      <el-row>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="Wo_FormItem" prop="Wo" :label="$t('message.autotrans._Model_IntgrSyncRemote_Wo')">
            <el-input v-model="searchDataIntgrSyncRemote.Wo" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="Sn_FormItem" prop="Sn" :label="$t('message.autotrans._Model_IntgrSyncRemote_Sn')">
            <el-input v-model="searchDataIntgrSyncRemote.Sn" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="TransSnId_FormItem" prop="TransSnId" :label="$t('message.autotrans._Model_IntgrSyncRemote_TransSnId')">
            <el-input v-model="searchDataIntgrSyncRemote.TransSnId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="ArchiveId_FormItem" prop="ArchiveId" :label="$t('message.autotrans._Model_IntgrSyncRemote_ArchiveId')">
            <el-input v-model="searchDataIntgrSyncRemote.ArchiveId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="LineId_FormItem" prop="LineId" :label="$t('message.autotrans._Model_IntgrSyncRemote_LineId')">
            <el-input v-model="searchDataIntgrSyncRemote.LineId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="LineCode_FormItem" prop="LineCode" :label="$t('message.autotrans._Model_IntgrSyncRemote_LineCode')">
            <el-input v-model="searchDataIntgrSyncRemote.LineCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="ProductId_FormItem" prop="ProductId" :label="$t('message.autotrans._Model_IntgrSyncRemote_ProductId')">
            <el-input v-model="searchDataIntgrSyncRemote.ProductId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="ProductName_FormItem" prop="ProductName" :label="$t('message.autotrans._Model_IntgrSyncRemote_ProductName')">
            <el-input v-model="searchDataIntgrSyncRemote.ProductName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="OpId_FormItem" prop="OpId" :label="$t('message.autotrans._Model_IntgrSyncRemote_OpId')">
            <el-input v-model="searchDataIntgrSyncRemote.OpId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="OpCode_FormItem" prop="OpCode" :label="$t('message.autotrans._Model_IntgrSyncRemote_OpCode')">
            <el-input v-model="searchDataIntgrSyncRemote.OpCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="ErpOpCode_FormItem" prop="ErpOpCode" :label="$t('message.autotrans._Model_IntgrSyncRemote_ErpOpCode')">
            <el-input v-model="searchDataIntgrSyncRemote.ErpOpCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="PassResult_FormItem" prop="PassResult" :label="$t('message.autotrans._Model_IntgrSyncRemote_PassResult')">
            <el-select v-model="searchDataIntgrSyncRemote.PassResult" clearable>
               <el-option key="OK" value="OK" :label="$t('message.autotrans._Enum_SnStatusEnum_OK')"></el-option>
               <el-option key="NG" value="NG" :label="$t('message.autotrans._Enum_SnStatusEnum_NG')"></el-option>
               <el-option key="MandatoryOK" value="MandatoryOK" :label="$t('message.autotrans._Enum_SnStatusEnum_MandatoryOK')"></el-option>
               <el-option key="MandatoryNG" value="MandatoryNG" :label="$t('message.autotrans._Enum_SnStatusEnum_MandatoryNG')"></el-option>
               <el-option key="Scrap" value="Scrap" :label="$t('message.autotrans._Enum_SnStatusEnum_Scrap')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="Status_FormItem" prop="Status" :label="$t('message.autotrans._Model_IntgrSyncRemote_Status')">
            <el-select v-model="searchDataIntgrSyncRemote.Status" clearable>
               <el-option key="Ready" value="Ready" :label="$t('message.autotrans._Enum_RemoteSyncStatusEnum_Ready')"></el-option>
               <el-option key="Completed" value="Completed" :label="$t('message.autotrans._Enum_RemoteSyncStatusEnum_Completed')"></el-option>
               <el-option key="Failure" value="Failure" :label="$t('message.autotrans._Enum_RemoteSyncStatusEnum_Failure')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="IsFirst_FormItem" prop="IsFirst" :label="$t('message.autotrans._Model_IntgrSyncRemote_IsFirst')">
            <el-select v-model="searchDataIntgrSyncRemote.IsFirst" clearable>
               <el-option :key="1" :value=true :label="$t('message._system.common.vm.tips_bool_true')"></el-option>
               <el-option :key="0" :value=false :label="$t('message._system.common.vm.tips_bool_false')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="IsCompelted_FormItem" prop="IsCompelted" :label="$t('message.autotrans._Model_IntgrSyncRemote_IsCompelted')">
            <el-select v-model="searchDataIntgrSyncRemote.IsCompelted" clearable>
               <el-option :key="1" :value=true :label="$t('message._system.common.vm.tips_bool_true')"></el-option>
               <el-option :key="0" :value=false :label="$t('message._system.common.vm.tips_bool_false')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="SyncMethod_FormItem" prop="SyncMethod" :label="$t('message.autotrans._Model_IntgrSyncRemote_SyncMethod')">
            <el-input v-model="searchDataIntgrSyncRemote.SyncMethod" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="SyncCount_FormItem" prop="SyncCount" :label="$t('message.autotrans._Model_IntgrSyncRemote_SyncCount')">
            <el-input v-model="searchDataIntgrSyncRemote.SyncCount" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="ErrMessage_FormItem" prop="ErrMessage" :label="$t('message.autotrans._Model_IntgrSyncRemote_ErrMessage')">
            <el-input v-model="searchDataIntgrSyncRemote.ErrMessage" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="CreatedTime_FormItem" prop="CreatedTime" :label="$t('message.autotrans._Model_IntgrSyncRemote_CreatedTime')">
            <el-date-picker v-model="searchDataIntgrSyncRemote.CreatedTime" type='daterange' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="StartTime_FormItem" prop="StartTime" :label="$t('message.autotrans._Model_IntgrSyncRemote_StartTime')">
            <el-date-picker v-model="searchDataIntgrSyncRemote.StartTime" type='daterange' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="EndTime_FormItem" prop="EndTime" :label="$t('message.autotrans._Model_IntgrSyncRemote_EndTime')">
            <el-date-picker v-model="searchDataIntgrSyncRemote.EndTime" type='daterange' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="Remark_FormItem" prop="Remark" :label="$t('message.autotrans._Model_IntgrSyncRemote_Remark')">
            <el-input v-model="searchDataIntgrSyncRemote.Remark" clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

  </WtmSearcher>

  <div style="text-align: right;">
      <WtmButton v-auth="'/api/IntegrationManagement/IntgrSyncRemote/Create'" icon='fa fa-plus' type='primary' :button-text="$t('message.autotrans.SysCreate')" @click="OnCreateClick()"/>
    <WtmButton v-auth="'/api/IntegrationManagement/IntgrSyncRemote/BatchDelete'"  icon='fa fa-trash' type='danger' :button-text="$t('message.autotrans.SysDelete')" :confirm="$t('message._system.common.vm.deletetip')" @click="onBatchDelete()"/>
    <WtmButton v-auth="'/api/IntegrationManagement/IntgrSyncRemote/BatchEdit'" icon='fa fa-pencil-square' type='primary' :button-text="$t('message.autotrans.SysBatchEdit')" @click="OnBatchEditClick()"/>
    <WtmButton v-auth="'/api/IntegrationManagement/IntgrSyncRemote/Import'" icon='fa fa-tasks' type='primary' :button-text="$t('message.autotrans.SysImport')" @click="OnImportClick()"/>
    <WtmButton v-auth="'/api/IntegrationManagement/IntgrSyncRemote/IntgrSyncRemoteExportExcel'"  icon='fa fa-arrow-circle-down' type='primary' :button-text="$t('message.autotrans.SysExport')" @click="onExport()"/>

  </div>
  <WtmTable ref="tableRefIntgrSyncRemote" v-bind="tableDataIntgrSyncRemote">
    <template #operation>
      <el-table-column :label="$t('message._system.common.vm.operate')" width="180">
        <template v-slot="scope">
            <WtmButton v-auth="'/api/IntegrationManagement/IntgrSyncRemote/Edit'" :is-text="true" icon='fa fa-pencil-square' type='warning' :button-text="$t('message.autotrans.SysEdit')" @click="OnEditrowClick(scope.row)"/>
          <WtmButton v-auth="'/api/IntegrationManagement/IntgrSyncRemote/{id}'" :is-text="true" icon='fa fa-info-circle' type='info' :button-text="$t('message.autotrans.Page详情')" @click="OnDetailsrowClick(scope.row)"/>
          <WtmButton v-auth="'/api/IntegrationManagement/IntgrSyncRemote/BatchDelete'"  icon='fa fa-trash' type='danger' :button-text="$t('message.autotrans.SysDelete')" :confirm="$t('message._system.common.vm.deletetip')" :is-text="true"  @click="onDelete(scope.row)"/>

        </template>
      </el-table-column>
    </template>
  </WtmTable>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageIntegrationManagementIntgrSyncRemoteIndex;true;Digitalmes.IntegrationManagement.Controllers;IntgrSyncRemote">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { intgrsyncremoteApi } from '/@/api/integrationmanagement/intgrsyncremote';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;

const CreateDialog = defineAsyncComponent(() => import('./create.vue'));
const EditDialog = defineAsyncComponent(() => import('./edit.vue'));
const DetailsDialog = defineAsyncComponent(() => import('./details.vue'));
const BatchEditDialog = defineAsyncComponent(() => import('./batchedit.vue'));
const ImportDialog = defineAsyncComponent(() => import('./import.vue'));

const stateIntgrSyncRemote9 = reactive({
    
});

const searchDataIntgrSyncRemote = ref({
        Wo: '',
        Sn: '',
        TransSnId: null,
        ArchiveId: null,
        LineId: null,
        LineCode: '',
        ProductId: null,
        ProductName: '',
        OpId: null,
        OpCode: '',
        ErpOpCode: '',
        PassResult: undefined,
        Status: undefined,
        IsFirst: undefined,
        IsCompelted: undefined,
        SyncMethod: '',
        SyncCount: null,
        ErrMessage: '',
        CreatedTime: undefined,
        StartTime: undefined,
        EndTime: undefined,
        Remark: '',
});

// 定义变量内容
const tableRefIntgrSyncRemote = ref();
const tableDataIntgrSyncRemote = ref({
    // 列表数据（必传）
    data: [],
	// 表头内容（必传，注意格式）
	header: [
      {title:ci.proxy.$t('message.autotrans.Page工单'),key: 'IntgrSyncRemote_Wo',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page追溯码'),key: 'IntgrSyncRemote_Sn',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page流转号'),key: 'IntgrSyncRemote_TransSnId',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page产品出站'),key: 'IntgrSyncRemote_ArchiveId',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page产线号'),key: 'IntgrSyncRemote_LineId',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page产线编码'),key: 'IntgrSyncRemote_LineCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page产品号'),key: 'IntgrSyncRemote_ProductId',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page产品名称'),key: 'IntgrSyncRemote_ProductName',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工位号'),key: 'IntgrSyncRemote_OpId',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工位编码'),key: 'IntgrSyncRemote_OpCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工厂工序编号'),key: 'IntgrSyncRemote_ErpOpCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page当前状态'),key: 'IntgrSyncRemote_PassResult',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page同步状态'),key: 'IntgrSyncRemote_Status',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page首站'),key: 'IntgrSyncRemote_IsFirst',type: 'switch',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page完工下线'),key: 'IntgrSyncRemote_IsCompelted',type: 'switch',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page同步方式'),key: 'IntgrSyncRemote_SyncMethod',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page执行次数'),key: 'IntgrSyncRemote_SyncCount',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page错误消息'),key: 'IntgrSyncRemote_ErrMessage',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page数据生成时间'),key: 'IntgrSyncRemote_CreatedTime',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page同步开始时间'),key: 'IntgrSyncRemote_StartTime',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page同步结束时间'),key: 'IntgrSyncRemote_EndTime',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans._AdminRemark'),key: 'IntgrSyncRemote_Remark',type: 'text',isCheck: true},

	],
	// 配置项（必传）
	config: {
        total: 0, // 列表总数
		loading: true, // loading 加载
		isSerialNo: true, // 是否显示表格序号
		isSelection: true, // 是否显示表格多选
		isOperate: true, // 是否显示表格操作栏
	}
});
// 初始化表格数据
const getTableDataIntgrSyncRemote = () => {
    tableRefIntgrSyncRemote.value.doSearch(intgrsyncremoteApi().search, searchDataIntgrSyncRemote.value)
        .catch((error: any) => {
			other.setFormError(ci, error);
		});
};
const OnCreateClick = () => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysCreate'), CreateDialog, null, getTableDataIntgrSyncRemote)
};

const OnEditrowClick = (row: any) => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysEdit'), EditDialog, row, getTableDataIntgrSyncRemote)
};

const OnDetailsrowClick = (row: any) => {
    other.openDialog(ci.proxy.$t('message.autotrans.Page详情'), DetailsDialog, row, getTableDataIntgrSyncRemote)
};

// 删除
const onDelete = (row: any) => {
    intgrsyncremoteApi().delete([row.ID]).then(() => { getTableDataIntgrSyncRemote()})
};

const onBatchDelete = () => {
    const selectedrows = tableRefIntgrSyncRemote.value.getSelectedRows();
    const selectedids = selectedrows.map((x: any) => x.ID);
    if (selectedids.length > 0)
      intgrsyncremoteApi().delete(selectedids).then(() => { getTableDataIntgrSyncRemote()})
    else
      ElMessage.error(ci.proxy.$t('message._system.common.vm.check'));
};

const OnBatchEditClick = () => {
    const selectedrows = tableRefIntgrSyncRemote.value.getSelectedRows();
    const selectedids = selectedrows.map((x: any) => x.ID);
    if (selectedids.length > 0)
      other.openDialog(ci.proxy.$t('message.autotrans.SysBatchEdit'), BatchEditDialog, selectedids, getTableDataIntgrSyncRemote)
    else
      ElMessage.error(ci.proxy.$t('message._system.common.vm.check'));
};

const OnImportClick = () => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysImport'), ImportDialog, null, getTableDataIntgrSyncRemote)
};

const onExport = () => {
	const selected = tableRefIntgrSyncRemote.value.getSelectedRows();
	if (selected.length > 0) {
		intgrsyncremoteApi().exportById(selected.map((x: any) => x.ID));
	}
	else {
		intgrsyncremoteApi().export({});
	}
};

// 页面加载时
onMounted(() => {
    
        getTableDataIntgrSyncRemote();

});

// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

